<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 登录,引入hdphp加密内核
*/
class LoginController extends PublicController
{
	/**
	 * 登录验证，调用hdphp加密内核加密
	 * @return [type] [description]
	 */
	public function checklogin(){
		 $data['adminname'] = I('post.adminname');
         $data['passwd'] = $this -> HdEncrypt(I('post.passwd'));
         $m = M('Root');
         $result = $m -> where($data) -> find();
         if ($result) {
         	 $_SESSION['aname'] = $result['adminname'];
         	 $_SESSION['rid'] = $result['rid'];
             $this -> redirect("Wecome/countdata");
         }else{
         	 $this -> error('用户名或密码错误');
         }
		 
	}
}